/**
 * 
 */
/**
 * Performed when page is loaded
 */
document.addEventListener('DOMContentLoaded', function() {
	var startYear;
	var endYear;
	var toDay;
	var fromDay;
	toDay = new Date();
	 fromDay = new Date();
	fromDay.setDate(toDay.getDate() - 14);
	endYear = toDay.getFullYear();
	startYear = endYear - 10;
	initDateSelect("fromYearSelect", "fromMonthSelect", "fromDaySelect",
			startYear, endYear, fromDay.getFullYear(), fromDay.getMonth() + 1,
			fromDay.getDate(), true);
	initDateSelect("toYearSelect", "toMonthSelect", "toDaySelect", startYear,
			endYear, toDay.getFullYear(), toDay.getMonth() + 1, toDay.getDate(),
			true);
	document.getElementById("btnApprove").onclick = submitApprove;
	document.getElementById("btnReject").onclick = submitReject;
	document.getElementById("btnSearch").onclick = submitSearch;
}, false);

function submitApprove(event) {
	var form = document.getElementById("form");
	form.setAttribute("action", "approve");
	form.submit();
	return false;
}

function submitReject(event) {
	var form = document.getElementById("form");
	form.setAttribute("action", "reject");
	form.submit();
	return false;
}

function submitSearch(event) {
	var form = document.getElementById("form");
	form.setAttribute("action", "listApprove");
	form.submit();
	return false;
}